package org.tinaelle.client.gui.grid.impl;

import org.tinaelle.client.utils.DefaultAsyncCallback;
import org.tinaelle.common.dto.AdElementTrlDTO;
import org.tinaelle.common.dto.AdLanguageDTO;
import org.tinaelle.server.service.AdTextServiceAsync;

import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtextux.client.data.GWTProxy;

public abstract class DefaultDataProvider extends GWTProxy {

	public AdLanguageDTO getAdLanguageDTO() {
		return null;
	}

	public ColumnConfig getColumnConfig(final String header, final String dataIndex) {
		final ColumnConfig columnConfig = new ColumnConfig( header, dataIndex );
		AdTextServiceAsync.Util.getInstance().getElementByName( columnConfig.getHeader(), getAdLanguageDTO(),
		        new DefaultAsyncCallback<AdElementTrlDTO>() {
			        public void onSuccess(final AdElementTrlDTO result) {
				        columnConfig.setHeader( result.getValue() );
			        }
		        } );
		return columnConfig;
	}

}
